using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Wen.Core.Converters {

	public sealed class BooleanToVisibilityConverter : IValueConverter {
		private static BooleanToVisibilityConverter _instance;

		public static BooleanToVisibilityConverter Instance {
			get { return _instance ?? (_instance = new BooleanToVisibilityConverter()); }
		}

		object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return (bool) value ? Visibility.Visible : Visibility.Collapsed;
		}

		object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
			throw new NotSupportedException();
		}

		private BooleanToVisibilityConverter() {
		}
	}

}